<?php if (!defined('THINK_PATH')) exit();?><!DOCTYPE html>
<html lang="en">
<?php $title = '我要提现'; ?>
<head>
	<meta charset="UTF-8">
	<title><?php echo ($title); ?></title>
    <meta name="viewport" content="width=device-width,initial-scale=1,user-scalable=0">
	<link rel="stylesheet" href="/Application/Home/View//Public/static/css/weui.min.css"/>
    <link rel="stylesheet" href="/Application/Home/View//Public/static/css/jquery-weui.min.css"/>
    <link rel="stylesheet" href="/Application/Home/View//Public/static/css/custom.css"/>
    <style type="text/css">
		body{
			background:#f1f1f1;
			color:#a3a3a3;
			font-family:"Microsoft YaHei";
		}
		.bd{
			padding:20px;
		}
        li{list-style: none;}
		p{
			font-size: 13px;
		}
		.weui-cell_select-before .weui-cell__hd:before{
			border-width: 0px 2px 2px 0;
			margin-top: -6px;
		}
		.weui-cell_select-before .weui-cell__hd:after{border:none;}
        .sstmb {
            padding-bottom: 60px;
        }
        .foot-ul{
			text-align:center;
			margin-top: 1rem;
			padding:10px;
			background: #22a9fe;
			opacity: 0.9;
		}
		.foot-ul a{
			color: #fff;
		}
		.foot-ul a img{
			max-width: 24px;
		}
		.pinglun{
			padding: 0 2px;
			background: #ff5959;
			border-radius: 50px;
			color: #fff;
			position: absolute;
			top:-6px;
			left:73px;
			font-size: 13px;
		}
		
		
		.weui-cell__bd p{
		color:#6b6969;
		}
        
	</style>
</head>

<body ontouchstart>


  <style type="text/css">
    
    body{
      background: #f4f4f4;
      color:#3b3b3b;
      font-family:"Microsoft YaHei";
    }
    .weui-cell{background: #fff;height: 2rem;}
   .weui-cell:before{left:0;}
   .weui-cell__bd input{
    font-family: '微软雅黑';
    margin-left: 1rem;
   }
.red::-webkit-input-placeholder { /* WebKit browsers */
color:#efa3a3;font-size:16px}
.red::-moz-placeholder { /* Mozilla Firefox 19+ */
color:#efa3a3;font-size:16px}
.red::-ms-input-placeholder { /* Internet Explorer 10+ */
color:#efa3a3;font-size:16px}
.botm p,h3{
  color:#de0000;
  margin:10px auto;
}
.botm{
  margin: 20px 0 20px 15px;
  }
  a{color:#22a9fe;}
  </style>


</head>
<body ontouchstart>
    <div class="container js_container">

    </div>
<div class="page">
  <div class="weui-cell ">
    <div class="weui-cell__hd"><label class="weui-label">提现金额</label></div>
    <div class="weui-cell__bd">
      <input  class="weui-input" type="number" pattern="[0-9]*" placeholder="提现金额" id='amount' onchange='cal_fax()'>
    </div>
  </div>
   <div class="weui-cell">
    <div class="weui-cell__hd"><label class="weui-label">未提现金额</label></div>
    <div class="weui-cell__bd">
      <input class="weui-input red" type="number" pattern="[0-9]*" id='balance' placeholder="¥<?php echo ($minfo["balance"]); ?>" data-val='<?php echo ($minfo["balance"]); ?>'>
    </div>
     <div class="weui-cell__ft"></div>
  </div>
   <div style="border-bottom: 1px solid #d9d9d9; " class="weui-cell">
    <div class="weui-cell__hd"><label class="weui-label">实际提现金额</label></div>
    <div class="weui-cell__bd">
      <input class="weui-input red" type="number" pattern="[0-9]*" placeholder="0元(税金0元)" id='cal_ret'>
    </div>
    <div class="weui-cell__ft"></div>
  </div>
  <div class="botm">
  <p><img style="vertical-align: sub;width:1rem;padding-right: 8px;" src="/Application/Home/View//Public/static/images/tixian.png"/>双休日及节假日不处理提现业务</p>
  <h3>提现说明</h3>
  <p>1.提现单位为百元，最少金额为100元。</p>
  <p>2.平台每日16点审核支付当天16点前用户提现申请款项。</p>
 <!-- <p>3.审核通过，提现款打入用户微信钱包。</p> -->
  <p>4.提现时将扣除3%的税金，<a href=""> 点击查看详情。</a></p>
  </div>
  
  <div style="margin:2rem auto;width:15rem;border-radius:20px;" class='demos-content-padded'>
      <a style="background:#22a9fe;" href="javascript:apply_withdraw();" class="weui-btn weui-btn_primary">我要提现</a>
    </div>
</div>
<input type='hidden' id="fax" value="" />
<input type='hidden' id="sj_amount" value="" />
    <script src="/Application/Home/View//Public/static/js/jquery-2.1.4.js"></script>
    <script src="/Application/Home/View//Public/static/js/jquery-weui.min.js"></script>
    <script src="/Application/Home/View//Public/static/js/fastclick.js"></script>
    <script src="/Application/Home/View//Public/static/layer/layer.js"></script>
    <script src="/Application/Home/View//Public/static/js/jquery.form.js"></script>
    <script>
      $(function() {
        FastClick.attach(document.body);
      });
    </script>
</body>
</html>

<script>
   function cal_fax(){
       if($.trim($("#amount").val())){
           var fax = parseFloat(parseFloat($.trim($("#amount").val()))*3/100,2);
           var fax_ret = Math.floor(fax * 100) / 100;
           var ret =  Math.floor((parseFloat($.trim($("#amount").val())) - fax)*100 )/100;
           $("#fax").val(fax);
           $("#sj_amount").val(ret);
           $("#cal_ret").attr("placeholder",ret +'元(税金'+fax_ret+'元)');
       }
   }

   function apply_withdraw(){
      if($.trim($("#amount").val()) == '' || $.trim($("#amount").val()) == 0){
          layer.open({
                    content:'请输入提现金额',
                    skin:'msg',
                    time:2
                })
      }else if($.trim($("#amount").val()) < <?php echo ($minfo["balance"]); ?>){
          layer.open({
                    content:'余额不足！',
                    skin:'msg',
                    time:2
                })
      }else{      
          if($("#amount").val() % 100 != 0){
                layer.open({
                    content:'提现金额必须为100的倍数！',
                    skin:'msg',
                    time:2
                })
           }else{
               $.ajax({
                   url:'<?php echo U("index/apply_withdraw");?>',
                   data:{'amount':$.trim($("#amount").val()), 'sj_amount':$("#sj_amount").val(), 'fax':$("#fax").val()},
                   type:'POST',
                   success:function(data){
                      if(data==1){
                          layer.open({
                                content:'申请成功，等待审核!',
                                skin:'msg',
                                time:2
                          })
                          setTimeout(function(){location.href='<?php echo U("index/awards");?>'}, 1000);
                      }else if(data == -99){
                          layer.open({
                                content:'余额不足!',
                                skin:'msg',
                                time:2
                          })
                      }else if(data == -98){
                          layer.open({
                                content:'扣款失败，请稍后重试!',
                                skin:'msg',
                                time:2
                          })
                      }else{
                          layer.open({
                                content:'系统繁忙，请稍后重试!',
                                skin:'msg',
                                time:2
                          })
                      }
                   }
               })
           }
       }
   }
</script>